@import "~bluedoc/mixin";

.reader-body {
  .container {
    width: auto;
  }

  .doc-sidebar {
    display: none;
  }

  .doc-body-toc {
    display: none;
  }

  @include breakpoint(lg) {
    .doc-sidebar {
      display: block;
      padding-top: 0px;
    }

    .toc-tree {
      width: 320px;
      height: calc(100vh - 50px);
      padding-top: 20px;
      padding-bottom: 30px;
      padding-left: 15px;
      padding-right: 20px;
      left: 0px;
      top: 50px;
      overflow-y: scroll;
      position: fixed;
      z-index: 3;
      background: #f3f4f7;
      border-right: 1px solid #edecf7;
    }

    .doc-body-toc {
      width: 180px;
      margin-left: 30px;
      display: none;
    }

    .doc-center {
      padding-left: calc(320px + 50px);
      padding-right: 50px;
    }

    .footer {
      display: none;
    }
  }

  @include breakpoint(xl) {
    .doc-body-toc {
      width: 230px;
      margin-left: 50px;
      display: none;
    }
  }

  .reader-navbar {
    font-size: 14px;
    .navbar-buttons {
      text-align: right;
      .fas {
        transform: scale(1.2);
        margin-right: 3px;
      }
      .btn-link {
        text-align: center;
        border: 0;
      }
      .dropdown-menu {
        top: calc(100% + 12px);
        text-align: left;
      }
    }
  }

  .versions-navbar {
    height: 48px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;

    .navbar-title {
      line-height: 48px;
    }
    .navbar-buttons {
      position: absolute;
      top: 0;
      right: 0;
      text-align: right;
      padding-top: 11px;
      form {
        margin-bottom: 0;
      }
    }
  }

  .main-container {
    padding: 0 !important;
  }

  .doc-page {
    position: relative;
    width: 100%;
    margin-top: 50px;
    .editors,
    .avatars {
      display: inline-flex;
      vertical-align: middle;
      .avatar {
        margin-right: 10px;
      }
    }
    .doc-sidebar {
      .doc-parents {
        @extend .card;
        @extend .card:hover;
        margin-bottom: 20px;
        padding: 15px 20px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
        background: #fff;

        text-align: left;
        .link-group {
          font-size: 14px;
          color: #333 !important;
        }
        .link-back {
          color: $primary;
          display: block;
          margin-bottom: 10px;
          padding-bottom: 10px;
          line-height: 100%;
          font-size: 20px;
          font-weight: bold;
          @extend .text-overflow;
          border-bottom: 1px solid #f0f0f0;
        }
      }
    }

    .doc-center {
      text-align: center;
    }

    .doc-main {
      margin: 0 auto;
      text-align: left;
      padding: 0px 0px;
      .unpublished-draft-tip {
        margin-bottom: 15px;

        .btn-abort {
          color: $danger;
        }
      }
    }

    .new_comment {
      overflow-x: hidden;
    }

    .doc-title {
      font-size: 26px;
      margin-bottom: 14px;
      text-align: left;
      word-break: break-word;
      word-wrap: break-word;
      overflow-wrap: break-word;
    }

    .doc-info {
      padding-bottom: 20px;
      margin-bottom: 30px;
      border-bottom: 1px solid #e6e6e6;
      color: $text-gray;
    }

    .doc-reaction {
      margin: 30px 0;
      .reaction-summary-item {
        border: 1px solid #f0f0f0;
        padding: 6px 10px;
        margin-right: 4px;
        .emoji {
          width: 1em;
          height: 1em;
          transform: scale(1.5);
          margin: 0 5px;
        }
        &.selected {
          border-color: rgba(148, 171, 240, 0.14);
        }
      }
    }

    .version-sidebar {
      padding-right: 20px;
      @extend .card-static;
      padding: 0;

      .pagination {
        .page-number {
          display: none;
        }
      }
    }

    .version-item {
      display: block;
      text-decoration: none;
      padding: 10px 15px;
      &.selected,
      &:hover {
        background: #f7f7f7;
      }
      .current {
        border: 1px solid #d9d9d9;
        border-radius: 12px;
        padding: 0 14px;
        line-height: 20px;
        transform: translateY(-3px);
      }
      &:last-child {
        border-bottom: 0px;
      }
      .title {
        font-size: 13px;
        margin-bottom: 5px;
      }
      .info {
        color: $text-gray-light;
      }
    }
  }

  .between-docs {
    .btn-link {
      padding: 10px 20px;
      max-width: 40%;
      font-size: 13px;
      &:hover {
        background: #f7f7f7;
      }
    }

    .btn-prev {
      float: left;
      &::before {
        font-size: 12px;
        display: block;
        margin-bottom: 5px;
        content: "Previous";
        text-align: left;
        color: $text-gray;
      }
    }
    .btn-next {
      float: right;
      &::before {
        font-size: 12px;
        display: block;
        margin-bottom: 5px;
        content: "Next";
        text-align: right;
        color: $text-gray;
      }
    }
  }

  .doc-readers {
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;

    .user-list {
      max-height: 450px;
      overflow: hidden;
      overflow-y: scroll;
    }
    .user-item {
      @extend .clearfix;
      padding: 8px 0;
      border-bottom: 1px solid #f0f0f0;

      &:first-child {
        padding-top: 0;
      }
      &:last-child {
        border-bottom: 0;
        padding-bottom: 0px;
      }

      a {
        color: #444;
      }

      .time-box {
        color: #a0a0a0;
        font-size: 13px;
        float: right;
      }
    }
  }

  .inline-comment-button {
    display: none;
  }

  @include breakpoint(md) {
    .inline-comment-button {
      display: block;
      visibility: hidden;
      font-weight: normal;
      color: #666;
      line-height: 100%;
      display: block;
      position: absolute;
      top: 0;
      right: -44px;

      &.has-comments {
        visibility: visible;
      }

      .inline-comment-button-icon {
        display: block;
        width: 45px;
        padding: 7px;
        border-radius: 3px;
        font-size: 13px;
        font-weight: normal;
        line-height: 100%;
        text-align: center;

        color: #666;

        &:hover {
          background: rgba(255, 250, 167, 0.73);
          color: rgba(125, 51, 32, 0.81) !important;
        }

        .fas {
          font-size: 17px;
        }
      }
    }
  }

  [nid] {
    position: relative;

    &.has-inline-comments,
    &:hover {
      .inline-comment-button {
        visibility: visible;
      }
    }
  }
}

.reader-body {
  .doc-share-page {
    .doc-main {
      padding: 0;
    }

    @media (min-width: 768px) {
      .doc-main {
        padding: 0;
      }
    }
  }
}

.doc-body-toc {
  & > .toc-list {
    position: fixed;
    padding-top: 48px;
    width: 230px;
    border-left: 1px solid #e8ebef;
    font-size: 13px;
    display: block;
    padding-top: 0;
    padding-left: 15px;

    .toc-list {
      padding-left: 11px !important;
    }

    .is-collapsed {
      display: none;
    }

    li {
      color: #888;
      list-style-type: none;
      list-style-position: inside;
      padding: 3px 0;
      display: block;

      &.is-active-li {
        & > a {
          color: #333;
          font-weight: bold;
        }
      }

      a {
        color: #696969;
        width: 100%;
        @extend .text-overflow;

        img {
          display: none;
        }
      }

      .heading-anchor {
        display: none;
      }

      @for $i from 3 through 5 {
        &.body-toc-item-#{$i} {
          padding-left: (($i - 2) * 11px) !important;
        }
      }
    }
  }
}

.reader-body:fullscreen {
  height: auto;
  width: 100%;
  overflow-y: scroll;
  &::backdrop {
    background-color: #fff;
  }
  .nav-header,
  .doc-sidebar,
  .reader-navbar,
  .doc-body-toc,
  .between-docs,
  .footer,
  .unpublished-draft-tip {
    display: none !important;
  }

  .doc-center {
    flex: none;
  }
  .doc-main {
    margin-left: auto;
    margin-right: auto;
    max-width: 90% !important;
  }

  .navbar-buttons {
    display: none !important;
  }
  .navbar-wide-mode {
    display: block !important;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.3);
    position: fixed;
    text-align: right;
    right: 0;
    z-index: 9999;
    opacity: 0.5;

    .btn {
      border-radius: 0;
      box-shadow: 0 0 0;
      border: 1px solid #d0d0d0;

      .fas {
        margin-top: 1px;
      }
    }

    &:hover {
      opacity: 1;
    }
  }

  .doc-title {
    padding: 50px 0 10px 0;
    margin: 0;
    text-align: center;
    font-size: 45px;
  }
  .markdown-body {
    font-size: 22px;
  }
}

.doc-export-pdf-box {
  .icon-box {
    text-align: center;
    .fas {
      font-size: 60px;
      color: #ff977e;
    }
  }

  .loading-box {
    text-align: center;
  }
  .loading {
    margin: 10px auto;
    background-repeat: no-repeat;
    background-position: center center;
    background-image: url("~images/loading.svg");
    background-size: 40px;
    width: 100px;
    height: 50px;
  }
}
